#ifndef __CCALL_FUNC_DELAY_H__
#define __CCALL_FUNC_DELAY_H__
#include "common.h"

typedef enum 
{
	CALL_FUNC_DELAY_WITH_NULL = 0,
	CALL_FUNC_DELAY_WITH_CCOBJECT
} CallFuncDelayType;

class CCallFuncDelay : public CCActionInterval
{
public:
	bool initWithDuration(float duration, SEL_CallFunc selector);
	bool initWithDuration(float duration, SEL_CallFuncO selector, CCObject* pObj = NULL);

	virtual CCObject* copyWithZone(CCZone* pZone);
	virtual void startWithTarget(CCNode *pTarget);
	virtual void update(float time);

	inline CCObject* getObject()
	{
		return m_pObject;
	}
	inline void setObject(CCObject* pObj)
	{
		if (pObj != m_pObject)
		{
			//CC_SAFE_RELEASE(m_pObject);
			m_pObject = pObj;
			//CC_SAFE_RETAIN(m_pObject);
		}
	}
public:
	static CCallFuncDelay* create(float duration, SEL_CallFunc selector);
	static CCallFuncDelay* actionWithDuration(float duration, SEL_CallFunc selector);

	static CCallFuncDelay* create(float duration, SEL_CallFuncO selectorO, CCObject* pObj = NULL);
	static CCallFuncDelay* actionWithDuration(float duration, SEL_CallFuncO selectorO, CCObject* pObj = NULL);

	CC_SYNTHESIZE_READONLY(CallFuncDelayType, m_eCallFuncDelayType, Type)

protected:
	SEL_CallFunc m_selector;
	SEL_CallFuncO m_selectorO;
	CCObject* m_pObject;
};

#endif  // __CCALL_FUNC_DELAY_H__